package org.raymond.iworks.study.basic.designpattern.mediator;

/**
 * @author raymond
 * @version V1.0
 * @Description: TODO
 */
public class CoffeeMachine extends Colleague {
    public CoffeeMachine(Mediator mediator, String name) {
        super(mediator, name);
        mediator.register(name, this);
    }

    public void finishCoffee(){
        System.out.println("5分钟以后...");
        System.out.println("咖啡做好了");
        sendMessage(0);
    }

    @Override
    public void sendMessage(int stateChange) {
        this.getMediator().getMessage(stateChange, getName());
    }

    public void startCoffee(){
        System.out.println("打开咖啡机");
    }
    public void stopCoffee(){
        System.out.println("关闭咖啡机");
    }
}
